Skip to content

feat(pm-stack): surface provider-auth keeper alerts on the board (#6671) - #6713

Merged
dezren39 merged 2 commits into
mainfrom
fallback/6671-keeper-alerts
Nov 7, 2026
Merged

dezren39 merged 2 commits into
mainfrom
fallback/6671-keeper-alerts

Conversation

@dezren39

@dezren39 dezren39 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Fixes #6671 (gap 6 of #6120).

Problem

The OpenDesign and Meta provider-auth keepers write their alert state (status: "attention", alert, alertSince) to opendesign-renewal.json / meta-renewal.json, but nothing outside the keeper modules and their tests read those files — a dying provider session was invisible on the aggregator board and in the readout the aggregator feeds, the silent-expiry failure mode the 2026-11-05 rule exists to prevent.

Change (pm-stack/aggregator)

  • New src/provider-auth-alerts.ts — projects both keeper state files into a ProviderAuthAlert[] with a reporting state per keeper: attention (status attention or a non-null alert), ok, missing, stale (checkedAt older than 45 min = three missed gather ticks), or invalid. Only whitelisted status/alert fields are projected — no credential or session value is read or rendered (a test poisons a fixture with secret-looking fields and asserts they never ride along). Missing/stale/invalid each render as their own visible "keeper not reporting" state, never as silence.
  • scripts/gather-quota.ts — after the keepers run, reads both state files back (same env-overridable paths the keepers write) and embeds the projection as providerAuth in quota-current.json: the surface updates within one gather cycle, and a keeper that died before writing still shows as missing/stale.
  • src/model.ts / src/quota-current.ts — QuotaCurrentFile.providerAuth and QuotaView.providerAuth (additive, inline-import types per the credentialLifecycle precedent); parseQuotaCurrent passes the section through and the overlay carries it onto the view, dropping malformed rows at the boundary.
  • src/render.ts — both quota board layouts render a "Provider auth" card listing every non-ok keeper with provider, reporting state, alert text, since (alertSince), and the horizon the keeper records (session expiry / last good). All-ok keepers render nothing.

Tests

  • New test/provider-auth-alerts.test.ts (bun test, keeper-pattern fixtures: temp state files, injected clock): attention naming provider + alertSince + horizon, both-valid → no problems, missing files → keeper-not-reporting lines, stale → stale, invalid JSON → invalid, whitelist poison test, plus gather→overlay→board tests (overlay carries the section; board HTML contains the alert; all-ok renders no card).
  • Ran on the laptop worktree: bun test test/provider-auth-alerts.test.ts test/quota-current.test.ts src/meta-renewal.test.ts src/opendesign-renewal.test.ts — 71 pass / 0 fail; bunx tsc --noEmit — clean.

🤖 Filed by repo-queue-worker Lane T in fallback mode (queue backend down 2026-11-06/07); the issue was the task.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 7, 2026 03:05
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2934ff69-f1ce-4007-8968-68b24df041f6
Commits

Reviewing files that changed from the base of the PR and between e632ea0 and 5226291.

Files selected for processing: 6

  • pm-stack/aggregator/scripts/gather-quota.ts
  • pm-stack/aggregator/src/model.ts
  • pm-stack/aggregator/src/provider-auth-alerts.ts
  • pm-stack/aggregator/src/quota-current.ts
  • pm-stack/aggregator/src/render.ts
  • pm-stack/aggregator/test/provider-auth-alerts.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T03:12:17.169993Z 5226291 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f9523320d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const out: QuotaView = { ...view, pools: allPools, gatherer: summarize(file, nowMs) };
// #6671: keeper alerts ride the same overlay; malformed rows are
// dropped at this boundary like every other gatherer field.
if (file.providerAuth) out.providerAuth = file.providerAuth.filter(isProviderAuthAlert);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate the providerAuth container before filtering

If an otherwise valid quota-current document contains a truthy non-array providerAuth value, such as {}, parseQuotaCurrent preserves it and this .filter() call throws. In src/sources/live.ts, the catch surrounding overlayQuotaCurrent then returns the base view, discarding all valid live quota overlays and gatherer diagnostics because one optional section is malformed. Check that the value is an array at the ingest boundary and isolate malformed provider-auth data rather than suppressing unrelated quota data.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the follow-up commit: parseQuotaCurrent now isolates the providerAuth section at the ingest boundary (non-array values drop the section, malformed rows are filtered there), and the overlay additionally guards with Array.isArray before filtering — a malformed optional section can no longer throw and suppress the unrelated quota overlay. Covered by the new test "a non-array providerAuth section is isolated at parse, never throws in the overlay".

const out: QuotaView = { ...view, pools: allPools, gatherer: summarize(file, nowMs) };
// #6671: keeper alerts ride the same overlay; malformed rows are
// dropped at this boundary like every other gatherer field.
if (file.providerAuth) out.providerAuth = file.providerAuth.filter(isProviderAuthAlert);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reevaluate keeper freshness when applying the overlay

When the gatherer stops after a successful tick, the last file retains reporting: "ok" indefinitely because freshness is computed only by readProviderAuthAlerts during gathering. This overlay copies that classification unchanged, and renderQuota hides every ok keeper, so even after checkedAt exceeds the 45-minute threshold the provider-auth surface never reports the stopped keepers. Reevaluate freshness against the overlay's serve-time now so a stopped gatherer cannot leave these alerts permanently hidden.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the follow-up commit: overlayQuotaCurrent now passes the alerts through reevaluateProviderAuth(file, now) — an ok keeper whose checkedAt is past the 45-minute stale horizon at serve time reclassifies to stale (attention/missing/invalid pass through), so a stopped gatherer can no longer leave a dead keeper hidden as ok. Covered by the new test "serve-time freshness: an ok keeper past the stale horizon reclassifies as stale", which also asserts the board renders "keeper not reporting".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant